package com.sl.au.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sl.au.entity.InvoiceTotalInfoView;
import com.sl.au.repository.InvoiceTotalInfoViewRepository;
import com.sl.au.service.InvoiceTotalInfoViewService;

@Service("InvoiceTotalInfoViewService")
@Transactional
public class InvoiceTotalInfoViewServiceImpl extends BaseServiceImpl implements InvoiceTotalInfoViewService {

	@Autowired
	InvoiceTotalInfoViewRepository invoiceTotalInfoViewRepository;
	@Override
	public InvoiceTotalInfoViewRepository getRepository() {
		// TODO Auto-generated method stub
		return this.invoiceTotalInfoViewRepository;
	}
	
	@Override
	public List<InvoiceTotalInfoView> findAllBykey(int start, int length, String key) {
		// TODO Auto-generated method stub
		Pageable pageable = new PageRequest(start / length, length, Sort.Direction.DESC, "createTime");
		Page<InvoiceTotalInfoView>  invoiceTotalInfos= invoiceTotalInfoViewRepository.findAllBykey(key, pageable);
		return invoiceTotalInfos.getContent();
	}
	@Override
	public long findAllBykeyCount(String key) {
		// TODO Auto-generated method stub
		return this.invoiceTotalInfoViewRepository.findAllBykeyCount(key);
	}

	@Override
	public List<InvoiceTotalInfoView> findAllBykey1(int start, int length, String key) {
		Pageable pageable = new PageRequest(start / length, length, Sort.Direction.DESC, "createTime");
		Page<InvoiceTotalInfoView>  invoiceTotalInfos= invoiceTotalInfoViewRepository.findAllBykey1(key, pageable);
		return invoiceTotalInfos.getContent();
	}

	@Override
	public long findAllBykeyCount1(String key) {
		// TODO Auto-generated method stub
		return this.invoiceTotalInfoViewRepository.findAllBykeyCount1(key);
	}

}
